"""财务页面"""
from selenium.webdriver.common.by import By
from page.base_page import BasePage
class FinancePage(BasePage):
    """数据准备"""
    url="/index.php?m=finance"
    #定位器
    accounts_receivable_name_locator=(By.CSS_SELECTOR,"body > div.container > div.page-header > ul > li.active > a")
    btn_finance_locator=(By.LINK_TEXT,"财务")
    add_ar_locator = (By.LINK_TEXT, "添加应收款")
    arn_locator = (By.ID, "name")
    click_tow_locator = (By.CSS_SELECTOR,"#form1 > table > tfoot > tr:nth-child(2) > td > div.pagination > div.span4 > div > ul > li:nth-child(3) > a")
    click_home_locator = (By.CSS_SELECTOR,"#form1 > table > tfoot > tr:nth-child(2) > td > div.pagination > div.span4 > div > ul > li:nth-child(1) > a")
    click_art_locator = (By.CSS_SELECTOR, "body > div.container > p > a:nth-child(13)")
    clean_up_the_environment_locator=(By.CSS_SELECTOR,"#form1 > table > tbody > tr:nth-child(1) > td:nth-child(1) > input")
    delet_locator=(By.ID,"delete")
    def click_finance(self):
        """点击财务"""
        self.find_element(self.btn_finance_locator).click()
    def click_accounts_receivable(self):
        """点击添加应收款"""
        self.click(self.add_ar_locator)
    def accounts_receivable_name(self):
        """返回添加成功名字"""
        return self.find_element(self.accounts_receivable_name_locator).text
    def click_two(self):
        """点击第二页"""
        self.click(self.click_tow_locator)
    def click_home(self):
        """点击首页"""
        self.click(self.click_home_locator)
    def click_art(self):
        """点击首页"""
        self.click(self.click_art_locator)
    def click_one_data(self):
        """选择第一条数据"""
        self.click(self.clean_up_the_environment_locator)
    def click_delete(self):
        """点击删除"""
        self.click(self.delet_locator)
    def click_sure(self):
        """弹出弹窗点击确定"""
        self.driver.switch_to.alert.accept()

